# import numpy as np
# import pandas as pd
# s = pd.Series([1, 3, 5, np.nan, 6, 8])
# dates = pd.date_range("20130101", periods=6)
# df= pd.DataFrame(np.random.randn(6,4), index=dates, columns=list("ABCD"))
# print(df)

# df2 = pd.DataFrame(
#     {
#         "A": 1.0,
#         "B": pd.Timestamp("20150102"),
#         "C": pd.Series(1, index=list(range(4)), dtype="float64"),
#         "D": np.array([3] * 4, dtype="int32"),
#         "E": pd.Categorical(["test", "train", "test", "train"]),
#         "F": "foo",
#     }
# )
# print(df2)

# print(df2.head(2))
# print(df.at[dates[0], "A"])                     #输出2013-01-01的A列
# print(df.iat[0, 1])                             #输出第0行第1列的值
# print(df.loc[:, "A"])                           #输出A列
# print(df.loc[dates[0]:dates[2], ["A", "B"]])    #输出2013-01-01到2013-01-03的A和B列
# print(df.loc[dates[0], ["A", "B"]])             #输出2013-01-01的A和B列
# print(df[df.A > 0])                             #输出A列大于0的行
# print(df[df > 0])                               #输出所有大于0的行
# print(df.iloc[3])                               #输出第4行
# print(df.iloc[3:5, 0:2])                        #输出第4行到第5行，第0列到第1列
# print(df.loc[dates[0]])                         #输出第0行（会以列的方式输出）         
# print(df > 0)                                   #输出每一个值是否大于0
# df2=df.copy()
# df2[1] = ["one", "one", "two", "three", "four", "three"]
# print(df2)
# s1 = pd.Series([1,3,5, np.nan, 6, 8], index=pd.date_range('20130101', periods=6))
# print(s1)
# df["F"] = s1
# # df.loc[:, "F"] = np.array(np.random.randn(6), dtype="float32")
# print(df)
# # df=df.fillna(value=5)
# print(pd.isna(df))
# df1 = df.reindex(index=dates[0:4], columns=list(df.columns) + ["E"])
# df1["E"]= ["one", "one", "two", "three"]
# print(df)
# print(df1)
# df=-df
# print(df)
# df2=df.sub(s1, axis="index")
# print(s1)
# print(df)
# print(df2)
# print(df)

# print(df.transform(lambda x: np.mean(x)*100))
# pieces = [df[:1], df[3:5]]
# print(pd.concat(pieces))
# left = pd.DataFrame({"key": ["foo", "123", "foo"], "lval": [1, 2,3]})
# right = pd.DataFrame({"key": ["foo", "123", "foo"], "rval": [4, 5,6]})
# print(left)
# print(right)
# print(pd.merge(left, right, on="key"))
# df = pd.DataFrame(
#     {
#         "A": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
#         "B": ["one", "one", "two", "three", "two", "two", "one", "three"],
#         "C": np.random.randn(8),
#         "D": np.random.randn(8),
#     }
# )
# print(df)
# df=df.groupby("B")[["C", "D"]].sum()
# print(df)

# import torch
# print(torch.cuda.is_available())
